#include <iostream>
#include <vector>
#include <list>

using namespace std;

class HashTableSeparateChaining {
private:
    vector<list<int>> table;
    int capacity;

public:
    HashTableSeparateChaining(int capacity) : capacity(capacity) {
        table.resize(capacity);  // 初始化哈希表，每个槽位是一个链表
    }

    int hashFunction(int key) {
        return key % capacity;  // 使用取余操作作为哈希函数
    }

    void insert(int key) {
        int index = hashFunction(key);
        table[index].push_back(key);  // 将元素插入对应槽位的链表末尾
    }

    bool search(int key) {
        int index = hashFunction(key);
        for (int element : table[index]) {  // 在对应槽位的链表中查找元素
            if (element == key) {
                return true;
            }
        }
        return false;
    }
};

int main() {
    HashTableSeparateChaining hashTable(10);

    hashTable.insert(5);
    hashTable.insert(15);
    hashTable.insert(25);

    cout << "Search 15: " << (hashTable.search(15) ? "Found" : "Not Found") << endl;
    cout << "Search 10: " << (hashTable.search(10) ? "Found" : "Not Found") << endl;

    return 0;
}